import { request } from '@/http'
import { services } from '@/config'

export function fetchList(query) {
  return request({
    url: `${services.assetService}receive/page`,
    method: 'get',
    params: query
  })
}

export function addObj(obj) {
  return request({
    url: `${services.assetService}receive`,
    method: 'post',
    data: obj
  })
}

export function getObj(id) {
  return request({
    url: `${services.assetService}receive/${id}`,
    method: 'get'
  })
}

export function delObj(id) {
  return request({
    url: `${services.assetService}receive/${id}`,
    method: 'delete'
  })
}
export function batchDelete(ids) {
  return request({
    url: `${services.assetService}receive/batchDelete`,
    method: 'delete',
    data: ids
  })
}

export function delReceiveList(ids) {
  return request({
    url: '/receivelist/receivelist/delReceiveList',
    method: 'get',
    params: { ids }
  })
}

export function putObj(obj) {
  return request({
    url: `${services.assetService}receive`,
    method: 'put',
    data: obj
  })
}

export function createReceive() {
  return request({
    url: `${services.assetService}receive/create`,
    method: 'get',
    params: { type: '0' }
  })
}

export function createWithdrawal() {
  return request({
    url: `${services.assetService}receive/create`,
    method: 'get',
    params: { type: '1' }
  })
}

export function edit(id) {
  return request({
    url: `${services.assetService}receive/edit/${id}`,
    method: 'get'
  })
}

export function print() {
  return request({
    url: '127.0.0.1:5006/ureport/preview?_u=file:test.ureport.xml',
    method: 'get'
  })
}
